package com.io.dto.sys;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.io.dto.BasePage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * The class/interface
 *
 * @author guod
 * @version 1.0 use jdk 1.8
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class UserReq extends BasePage {

    public interface Login {
    }

    public interface InsertUser {
    }


    public interface UpdatePassword {
    }

    public interface UpdateUser {
    }

    /**
     * 主键ID
     */
    @NotNull(message = "用户主键ID不能为空", groups = {UpdateUser.class})
    @ApiModelProperty(value = "主键id", name = "id", example = "1")
    private Long id;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", name = "createDate", example = "2020-12-14")
    private LocalDateTime createDate;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "修改时间", name = "updateDate", example = "2020-12-14")
    private LocalDateTime updateDate;

    /**
     * 删除标记
     */
    @ApiModelProperty(value = "删除标记", name = "delFlag", example = "1")
    private Integer delFlag;

    /**
     * 备注信息
     */
    private String note;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序", name = "sort", example = "2020-12-14")
    private Integer sort;

    /**
     * 登录名称
     */
    @NotNull(groups = {Login.class, InsertUser.class}, message = "登录名称不能为空")
    @ApiModelProperty(value = "登录名称", name = "username", example = "user")
    private String username;

    /**
     * 用户密码
     */
    @NotNull(groups = {Login.class, InsertUser.class, UpdatePassword.class}, message = "用户密码不能为空")
    @ApiModelProperty(value = "用户密码", name = "password", example = "123456")
    private String password;

    /**
     * 用户新密码
     */
    @NotNull(groups = {UpdatePassword.class}, message = "新密码不能为空")
    @ApiModelProperty(value = "用户新密码", name = "newPassword", example = "password")
    private String newPassword;

    /**
     * 姓名
     */
    @NotNull(groups = {InsertUser.class}, message = "姓名不能为空")
    @ApiModelProperty(value = "姓名", name = "name", example = "张三")
    private String name;

    /**
     * 性别
     */
    @NotNull(groups = {InsertUser.class}, message = "性别不能为空")
    @ApiModelProperty(value = "性别", name = "gender", example = "男")
    private String gender;

    /**
     * 出生日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "出生日期", name = "birthday", example = "2020-12-14")
    private LocalDateTime birthday;

    /**
     * 单位
     */
    @ApiModelProperty(value = "单位", name = "birthday", example = "云河")
    private String unit;

    /**
     * 地址
     */
    @ApiModelProperty(value = "地址", name = "address", example = "河南郑州")
    private String address;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱", name = "email", example = "10079@163.com")
    private String email;

    /**
     * 证件号码
     */
    @ApiModelProperty(value = "证件号码", name = "cno", example = "41042319999999")
    private String cno;

    /**
     * 手机号码
     */
    @ApiModelProperty(value = "手机号码", name = "tel", example = "18838177689")
    private String tel;

    /**
     * 盐值
     */
    @ApiModelProperty(value = "盐值", name = "salt", example = "4848f4ds4df48sdfa")
    private String salt;

    /**
     * 角色
     */
    private Long role;

    /**
     * 角色ID列表
     */
    @ApiModelProperty(value = "角色ID列表", name = "roleIdList", example = "[1,2]")
    private List<Long> roleIdList = new ArrayList<>();

    /**
     * 用户状态
     */
    @ApiModelProperty(value = "用户状态", name = "userStatus", example = "1")
    private Long userStatus;
}
